package controller;

import POJO.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import service.UserService;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * Created by 薛梓浩 1 on 2019/1/3.
 */
@Controller
@RequestMapping("/User")
public class UserController {

    @Resource
    private UserService userService;

    @RequestMapping("/login")
    public String Login(User user, HttpSession session){

        User u=userService.Login(user);
        if(u!=null){
            session.setAttribute("user",u);
            return "blank";
        }
        return "sign_in";
    }

    @RequestMapping("/zhuxiao")
    public String zhu(HttpSession session){

        session.removeAttribute("user");
        return "sign_in";

    }
}
